home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1998 January
/
Macworld (1998-01).dmg
/
Games World
/
Game Utilities
/
TexRay Workbench 1.0
/
TexRay Workbench Guidelines
< prev
next >
Wrap
Text File
|
1997-06-08
|
19KB
|
308 lines
Overview
Welcome to the world of creating Marathon textures using Bryce! What
follows is kind of a "brain dump" of things I've discovered while creating
such textures. Please send me comments regarding these various thoughts, and
of course send me any of your own. I will add them to this document as I
receive them, and also try to organize this information a bit more coherantly
when I have a better idea of how to do so.
Send comments to:
(Tim Thomas) thomas@urbana.css.mot.com
Note that the techniques described here can be applied to any game that uses
texture mapping. If you end up using Bryce to raytrace textures for Marathon
or any other game, please drop me a line. I'd be interested in how far this
stuff goes! Happy texturing! :-)
Tips on Object Sizes and Placement
The templates I've created place a block at the center of the coordinate system that
is 20.48 by 20.48 units square (x and z axis, respectively. You will note that this is the
unit size for a Brycean object. This was done deliberately so that the various Bryce
shortcuts would work well with the block and other objects placed in the scene. I suggest
you study the various Bryce shortcuts for moving objects around. They will really make it
much much easier to place things in your scene.
Now, let's talk about Marathon texture sizes and how they relate to Bryce units. The final
texture is going to be 128x128 pixels square. The camera in my templates is focused on
a block 20.48x20.48 units square. What that means is one pixel in the scene is .16 units
square (20.48 / 128). What that means is if you make an object smaller than that you won't
see much. :-)
Now let's say you want to make a cylindrical object placed lengthwise on your texture.
Cylindrical objects are, well, round. :-) That means that when you render the object
the pixels across the diameter will be various shades of whatever color you've picked for the
object. However, each ramp in a Marathon color map usually has 14 colors in it, so the
cross-section of your cylinder will have at most around 14 colors. 14 x .16 = 2.25. If you
make your cylinder have a diameter significantly larger than 2.25 units you will end up with
nasty banding when the cylinder is rendered. And of course the same guidelines apply to
spheres. Squashing a cylinder (or sphere) can give you a bit of leeway, since the
center part of the object will be rendered with roughly the same color. The bottom line is,
large gently sloping parts of a texture will turn into stairsteps when rendered, so don't
do that. :-)
To AntiAlias or Not to AntiAlias
When rendering textures in Bryce you will need to decide whether to antialias
a texture. If you antialias the texture then it will tend to look more realistic.
However, it will also tend to look blurrier. If you don't antialias then the
edges will appear sharper; however, objects in the texture may also appear more
blocky.
My solution is to always antialias in Bryce. However, this results in an
especially blurry line at sharp transitions between light and dark parts of the
texture. So in Photoshop I clean up these transitions using the clone tool, with
the brush set to a single pixel. The burn tool may also be useful for this but I
haven't tried it yet.
As a final comment on this subject, if you are using the pure blue color to
represent transparent parts of your texture then you will need to make sure
you select all parts of the texture in Photoshop with that bluish color (since
Bryce will no doubt hue shift some of the blue pixels) and fill them with the
pure blue color. Otherwise the transparent areas will have a bluish "halo"
around them.
Making Sharp Lines and Distinct Small Objects
Unfortunately I don't think you can make sharp lines and distinct small objects in a
128x128 texture using Bryce. If you antialias then of course lines and small objects will
appear blurry. However, even if you don't the lines and small objects will still likely be
blurry because of the way raytracing engines (like Bryce) work.
Bryce casts a ray from the camera through a pixel onto your scene. Unless the ray
exactly strikes the edge of your object, Bryce will average the values on either side of
the edge of the object, thus creating a blurry, indistinct edge. This is not a problem
at high resolutions. However, sorry folks, but we are dealing with 128x128 textures,
and that quite frankly is a pretty rough resolution as far as raytracing goes. To be sure,
the texture will look fine far away and even probably at medium range -- if you have a
full range of colors to choose from. However, we are also dealing with a rather limited
color map, with more-or-less 14 colors on any particular color ramp.
The solution is to post process the texture in Photoshop for instance. The clone tool set
to use a single pixel brush works wonders. As I mentioned elsewhere the burn
tool may also be useful.
Let's say you want to clean up a horizontal edge. Select the clone tool and option click
a couple pixels above the edge to set the clone tool's start point. Just below this start
point, just next to the edge, click and drag along the edge. You will in essence be duplicating
the pixels along the edge. This duplication seems to be all but invisible, but you will find
that the edge is now very distinct.
And of course let's say you have an edge that needs to be a solid color, like the edge of a
screen for instance. You can always use the draw tool set to a single pixel, option click on
an appropriate color on the edge, and drag along the edge. The burn tool could also be used
to produce a similar effect.
Specular Highlights
The Bungie Marathon textures tend to have very bright specular highlights.
That is, the parts of the texture that are angled toward the light tend to be
very bright compared to the parts of the texture that are flat. Until recently
I found it difficult to produce a similar effect using Bryce, due to the fact that
I was setting the diffusion value for the lights used in the scene to a high level.
The solution of course is, "Don't do that." :-)
So with that in mind, in order to produce a texture with bright specular highlights on the
edges of the various objects in the scene, you need to bevel the edges of your objects and
then turn up the specular highlights slider in the Materials editor. You can also try turning
up the reflectivity slider a bit.
To bevel the edges of your objects, you can either create a gray map in
Photoshop with the edges of the light areas blurred, and then read in the gray
map as a terrain, or you can play with Bryce's primitives, for example
intersecting two square bars with one rotated 45°.
Dark Edges in the Upper and Left Sides of a Texture
When rendering you may notice a single row of dark pixels on the upper and/or
left side of the texture. This is because the camera is positioned to have a
field of view reaching the very edge of a unit square positioned at the center
of the coordinate system. If the edges of your texture are lower due to the
way they are constructed (for example the main part of the texture is a terrain
with beveled edges) then Bryce may "see" the black space outside of the unit
square and render it accordingly. The solution is to zoom the camera in a
small distance (say about 14 units).
Creating Tileable Textures
Bryce is great at creating textures that don't repeat themselves. Getting it to
do the "lesser" job of creating repeatable textures however seems to be all
but impossible. One way to do this is to create a repeatable texture using some
other program (like KPT Texture Explorer 2.1) and using it as a pict texture in
Bryce. The way I do it, however, is to create the non-repeating texture in
Bryce and then in Photoshop use the clone tool to "fix" the non-matching edges
of the texture after offsetting the texture 64 pixels in the horizontal and
vertical directions using the offset filter (thus placing all of the edges of the
texture in the middle of the texture). Actually, I've found that after converting
the texture to indexed color mode in Photoshop many of the edges look ok
anyway without modification. Go figure...
Converting Textures Into Indexed Color Mode
When you save a Bryce texture after rendering it, it will be saved in 32 bit
RGB mode. In order to use it properly in Marathon it must be converted to
an Indexed Color Mode pict. In Photoshop this is easy enough to do. Just
open the Indexed Color Mode dialog from the Mode menu, select custom... as
the palette, at the Color Table dialog read in the appropriate Marathon color
map (which you can create by exporting a color map from Anvil), and press ok.
At this point you can select the texture and copy it to the clipboard and from
there load it into Anvil. However, if you want to save the texture as an
indexed color mode pict you must first delete the alpha channel Bryce places
in the texture (to indicate how far it got in the render) and then save the texture.
Otherwise Photoshop will not let you save the texture as an indexed color mode
pict. Alternatively you can select Save a Copy... from the File menu.
As a final comment on this subject note that there appears to be a bug in how
Anvil handles a texture in a format other than indexed color mode, even if all the
colors in the texture are in the proper color palette. Anvil will insist on
sometimes dithering some colors. Therefore it is wise to always use indexed
color mode picts with Anvil, even when you are positive all of the colors in
the pict are in the proper color palette.
Creating Textures with Colors in Marathon's Color Map(s)
Whoo boy! This is the true tough problem using Bryce to create textures!
Here's the problem: You can set up a Bryce material so that all of the colors
in the material are in the various Marathon color ramps, but when you render
the texture you find that the colors are no longer on the color ramps! There are
two reasons for this:
1) Virtually all of the standard Marathon color ramps use fully saturated colors
with varying brightness levels and constant hue. However, in Bryce (and
Photoshop for that matter) when you vary the brightness of a texture you
effect not only the brightness but also the saturation. This is because the
color model they use simulates real world conditions in which this is the
case. Think of it this way: As you shine an increasingly bright light on an
object it will get brighter and brighter and more and more saturated.
However, at some point the brightness will overwhelm the color of the
object such that it becomes less and less saturated until it completely
whites out.
2) Bryce goes one step further and apparently models what is called the
Bezold-Brucke Effect (see page 8 of Color and the Computer by H. John
Durrett, Academic Press, Inc., 1987, ISBN 0-12-225210-1). What this
means is that, when the brightness of an object changes, the hue physically
does not change (that is, the wavelength of light does not change -- just
the magnitude of the waves); however, the human perception of the hue
does change. Furthermore the hue shift is not consistent across the
spectrum -- some colors shift one way and others the other way as the
brightness changes. In addition, 3 colors (pure blue, pure green, and
pure yellow) demonstrate no change as the brightness changes.
I have not verified that Bryce truely implements this effect. However, of one
thing I am certain: Bryce is shifting the hues depending on brightness. I
also know that Photoshop shifts the hue around when you change saturation
and lightness so it may also be implementing this effect to some degree.
The end result is that after rendering a Bryce texture you can end up with
colors all over the color map which is not what you want.
So how do we fix this? Well, definitely try to start will colors in a Material
that are the brightest (and lightest) of the colors in a Marathon color ramp.
Also, try to start with fully saturated colors. Render the image and then
pull the resulting pict into Photoshop. Now the fun begins...
In Photoshop use the Color Range... dialog in the Select menu. Set the
Fuzziness really low (say 4 for instance). Set the eyedropper to + so that
successive mouse clicks add colors to the selected color mask. Now start
clicking and dragging the mouse over the areas of your texture that you want
to adjust the colors. When you are happy with the selection mask press ok.
Now, under the Image menu->Adjust submenu select Hue/Saturation... to
adjust the hue and saturation of the colors in the selection. In the
Hue/Saturation dialog adjust the Saturation and Lightness sliders.
Move the mouse over the area selected in your texture and look at the RGB/HSB
values displayed in the Info dialog to see how your changes to Saturation
and Lightness are effecting the Hue, Saturation, and Brightness of the colors
in the selected area. It is helpful to load the Marathon color
map you are trying to use with the texture into the Swatches dialog. If you
do this then you can also move the mouse over the various color swatches to
compare their values to those used by your texture to see how close they are
to each other.
I have found that with sufficient patience you can get many if not most of
the selected colors back onto the ramps of your selected Marathon color map.
This is a bit of a pain, but it works. Usually you will find you need to max out
the Saturation slider and then reduce the Lightness slider. Again you will notice
as you play around with the Saturation and Lightness sliders that the Hue,
Saturation, and Brightness of the colors in your texture all interact with each
other. Fun fun fun. :-/
Removing Unwanted Brightness Changes So Textures Tile Better
If you render a Bryce texture, bring it into Photoshop, and convert the colors to
those in a Marathon color map, you will likely find the texture is brighter in the
upper part of the texture and darker in the lower part (especially if you use the
template I've created). The reason is because, if you are using lighting similar
to what I use in my template, you will have a large light (or two) shining down
onto the texture at an angle from above. Since the light is shining at an angle
you will run into the light inverse square law, where the brightness of the light
drops off as the square of the distance.
Although this dropoff is slight for such small textures, it is significant enough
to cause headaches when you convert the texture to use a Marathon color map.
Remember: Marathon color map ramps have a rather limited number of colors.
You can end up with shifts large enough to jump 3 colors in a ramp from the top
to bottom of your texture. This can be quite ugly, especially when you tile the
texture.
The solution is to factor out the inverse square law from your texture. Note that
if you are using point sources for lights then you can ignore this problem since,
well, you are going to have drastic changes in lighting anyway if the lights are
close enough, and that is probably what you want. But if you are using large
parallel lights like I do in my template you will want to factor out the light
changes.
I have created an adjustment pict in the templates directory to do this. To use it,
read it into Photoshop and convert it to Lab color mode and select the lightness
channel. Now read in your rendered texture. Convert your rendered texture to Lab
mode as well and also select the lightness channel. Next select Apply Image... from
the Image menu. Set the Source to be the adjustment pict and the Blending mode
to Add and press ok.
Note that this adjustment pict only works with the template I've created. If you change
the lighting in the template or make own lighting then you will need to create your own
adjustment pict. Here's how to do it: Set up the lighting in your Bryce scenario file as
you want it, and place a default gray object in your scene at the center of the coordinate
system which is large enough to completely fill the rendered image. Nor render the
texture. It should of course appear completely gray, with slightly varying brightness
levels as dictated by your lighting. Now bring this rendered gray texture into Photoshop.
Invert the texture. Now select the Histogram... entry from the Image menu and note the
lowest gray value that has any pixels in your texture. Now set the foreground color to be
this lowest gray value (just set the RGB values to the gray value for example). Next
select Fill... from the Edit menu, set the dialog to use the foreground color and set the
Mode to Difference and press ok. You have now created an adjustment pict. Save this
pict and use it whenever you use that particular lighting setup.
Dealing with the Mysterious Black Line Down the Center of the Texture
You may render a texture and discover this nasty pitch black line running vertically straight
through the center of your texture. At the Antialiasing phase the line may gray out a bit, but
nonetheless it's there. This appears to be a bug in Bryce. If you group a terrain object with
some other object, to cut a hole in the terrain for instance by setting the other object to
negative, Bryce will render the black vertical line.
Fortunately the solution is very simple. Change the camera setup so that the camera is
rotated 360° around the Z axis. No kidding. :-) Strange as it sounds, doing that reduces the
nasty black line to a single black pixel in the center of the texture (which is grayed out
during the Antialiasing phase).
Dealing with Mysteriously Disappearing Objects and Corrupted Scene Files
I sincerely hope you never ever ever have to deal with this problem, so please read the
following carefully. It will save you a great deal of grief, heartache and pain.
If you create a material that has a 2d pict as one of the textures, never ever ever save that
material in the materials list. If you do and subsequently use it, then Bryce will make it look
like the scene is fine. But as soon as you close and reopen the scene file you will find some
of the objects not present in your scene at all, and there will be at least one object in the
scene that is corrupted -- it will be grayed out and you won't be able to explicitly select it.
Furthermore, if you try to be clever and delete all selectable objects and then use select all
to select the grayed out object and then try to look at its attributes or family you will find
either bogus values or Bryce will crash your machine.
This is obviously a bug in Bryce. Beware of it. I lost two nice textures because of this, with
several machine crashes in the process. Since I finally figured out the cause I need to let
MetaTools know about the problem. In the mean time, quite frankly really really watch out
whenever you use 2d picts as textures in a Material. I suggest saving backups of your texture
frequently so that if you introduce corruption you can at least back up and fix the problem.